package phoeics.authoryserver.webservice.security;

import java.util.Collection;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import phoeics.authoryserver.webservice.entity.OauthUser;

public class Account implements UserDetails{

	/**
	 * @Description: 
	 */
	private static final long serialVersionUID = 1L;
	private OauthUser oauthUser;
	private  Collection<? extends GrantedAuthority> authorities;
	
	public Account(){}
	public Account(OauthUser oauthUser,Collection<? extends GrantedAuthority> authorities){
		this.authorities=authorities;
		this.setOauthUser(oauthUser);
	}
	//返回分配给用户的角色列表
	@Override
	public Collection<? extends GrantedAuthority> getAuthorities() {
		// TODO Auto-generated method stub
		return authorities;
	}

	@Override
	public String getPassword() {
		// TODO Auto-generated method stub
		return oauthUser.getPassword();
	}

	@Override
	public String getUsername() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean isAccountNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isAccountNonLocked() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isCredentialsNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return true;
	}
	//private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Account.class);
	public OauthUser getOauthUser() {
		return oauthUser;
	}
	public void setOauthUser(OauthUser oauthUser) {
		this.oauthUser = oauthUser;
	}
}
